const {
  VantResolver
} = require('unplugin-vue-components/resolvers');
const ComponentsPlugin = require('unplugin-vue-components/webpack');

const {
  defineConfig
} = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    proxy: {
      // https://bsty4.com/excuse/live/getBannerList
      '/excuse': {
        target: 'https://bsty4.com',
        ws: false,
        changeOrigin: true,
        headers: {
          'content-type': 'application/json; charset=utf-8'
        }
      },


      // https://api.qiecdn.com/api/video_app/index
      '/video_app': {
        target: 'https://api.qiecdn.com/api',
        ws: false,
        changeOrigin: true,
      },
      //人工智能回答
      //http://api.qingyunke.com/api.php
      '/api.php': {
        target: 'http://api.qingyunke.com',
        ws: false,
        changeOrigin: true,
      },

      // https://haokan.baidu.com/videoui/api/videorec
      //视频一
      '/videoui': {
        target: 'https://haokan.baidu.com',
        ws: false,
        changeOrigin: true,
        headers: {
          referer: 'https://haokan.baidu.com/v?vid=12355222912594130461&source=1022897c-0-1023778d&pkg=1023778d&ckey=CK1448646945528',
          secFetchDest: 'empty',
          secFetchMode: 'cors'
        }
      },
    }
  },
  configureWebpack: {
    plugins: [
      ComponentsPlugin({
        resolvers: [VantResolver()],
      }),
    ],
  },
})